package gui;

import java.awt.Color;
import java.awt.GridBagLayout;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Dimension;
import javax.swing.JLabel;

import code.Language;
import code.Settings;

import java.awt.Rectangle;
import java.io.File;
import java.util.HashMap;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;

public class DigitalSignatureMain extends JPanel {

	Color c= new Color(0x80, 0x80, 0xFF);
	
	Color TAc = new Color(246, 250, 250);
	
	private static final long serialVersionUID = 1L;
	
	private JLabel jLabel = null;

	private JLabel jLabel1 = null;

	private JLabel jLabel2 = null;
	
	private HashMap labels;
	
	ATOCOmain atocoframe;

	private JLabel jLabel3 = null;

	private JLabel jLabel4 = null;

	private JLabel jLabel5 = null;

	private JScrollPane jScrollPane = null;

	private JTextArea jTextArea = null;
	
	Border empty = new EmptyBorder(0,0,0,0);
	private Settings s;

	/**
	 * This is the default constructor
	 */
	public DigitalSignatureMain(ATOCOmain atocoframe) {
		super();
		Settings s = new Settings();
		Language l = new Language();
		labels = l.changeLanguage((String) s.global.get("language"), "DigitalSignatureMain", (String) s.global.get("installPath"));
		this.atocoframe=atocoframe;
		initialize();
		this.setPreferredSize( new Dimension( 400, 400 ) );
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		ImageIcon help = new ImageIcon((String) labels.get("help"));
		jLabel5 = new JLabel(help);
		jLabel5.setBounds(new Rectangle(11, 315, 81, 86));
		jLabel5.setVisible(false);
		jLabel4 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/questionmark.jpg"));
		jLabel4.setBounds(new Rectangle(435, 170, 25, 25));
		jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				jScrollPane.setVisible(true);
				jLabel5.setVisible(true);
				jTextArea.setText((String) labels.get("verify"));
			}
		});
		jLabel3 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/questionmark.jpg"));
		jLabel3.setBounds(new Rectangle(35, 170, 25, 25));
		jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				jScrollPane.setVisible(true);
				jLabel5.setVisible(true);
				jTextArea.setText((String) labels.get("creation"));
			}
		});
		jLabel2 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/verify_sign.gif"));
		jLabel2.setBounds(new Rectangle(465, 90, 336, 203));
		jLabel2.setText((String) labels.get("jLabel2"));
		jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				atocoframe.contentPane(new VerifyDigitalSignature(atocoframe));
			}
		});
		jLabel1 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/sign_document.gif"));
		jLabel1.setBounds(new Rectangle(63, 88, 327, 202));
		jLabel1.setText((String) labels.get("jLabel1"));
		jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				atocoframe.contentPane(new SignDigitalSignature(atocoframe));
			}
		});
		jLabel = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/digitalSig1.gif"));
		jLabel.setBounds(new Rectangle(15, 13, 108, 64));
		this.setSize(840, 486);
		this.setLayout(null);
		this.setBackground(Color.WHITE);
		this.add(jLabel, null);
		this.add(jLabel1, null);
		this.add(jLabel2, null);
		this.add(jLabel3, null);
		this.add(jLabel4, null);
		this.add(jLabel5, null);
		this.add(getJScrollPane(), null);
	}

	/**
	 * This method initializes jScrollPane	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getJScrollPane() {
		if (jScrollPane == null) {
			jScrollPane = new JScrollPane();
			jScrollPane.setBounds(new Rectangle(104, 316, 571, 134));
			jScrollPane.setViewportView(getJTextArea());
			jScrollPane.setBorder(empty);
			jScrollPane.setVisible(false);
		}
		return jScrollPane;
	}

	/**
	 * This method initializes jTextArea	
	 * 	
	 * @return javax.swing.JTextArea	
	 */
	private JTextArea getJTextArea() {
		if (jTextArea == null) {
			jTextArea = new JTextArea();
			jTextArea.setBackground(TAc);
			jTextArea.setLineWrap(true);
			jTextArea.setWrapStyleWord(true);
			jTextArea.setEditable(false);
		}
		return jTextArea;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
